package Server;

/*
 * File:    VallaSecundaria.java
 * Coms: Esta clase construye el JFrame y el Container.
 * Construye y lanza 4 Thread de VallaSecundariaLabel    
 * 		   
 */

/**
 * @author Daniel Cabrera Ebana - 686013
 * @author Alberto Sanchez Romero - 662385
 * @since 
 */
import java.awt.Container;
import java.awt.GridLayout;
import java.awt.Image;
import java.io.File;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;

public class VallaSecundaria implements Runnable {

	static File directorio;
	static Thread[] jlabels = new Thread[4];// array de threads
	static JFrame frame;
	static Container content;
	static JLabel[] labels = new JLabel[4];
	ImageIcon banner;
	GestorRecursos gestor;

	/**
	 * Constructor de la valla secundaria
	 * 
	 * @param File
	 * @param GestorRecursos
	 * @see GestorRersos.java
	 * @see VallaSecundariaLabel
	 */
	public VallaSecundaria(File directorio, GestorRecursos gr) {
		VallaSecundaria.directorio = directorio;
		this.gestor = gr;

		frame = new JFrame("VALLA SECUNDARIA");
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		content = frame.getContentPane();
		content.setLayout(new GridLayout(2, 2));

		for (int j = 0; j < jlabels.length; j++) {

			jlabels[j] = new Thread(new VallaSecundariaLabel(gestor,
					directorio, frame, content, labels, j));

		}

		frame.setSize(600, 600);
		// frame.pack();
		frame.setVisible(true);
		frame.setResizable(false);

	}

	public void run() {

		for (int j = 0; j < jlabels.length; j++) {

			jlabels[j].start();

		}

	}

}
